package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstNewrankArticleDao;
import com.financing.wap.dto.DstNewrankArticleDTO;
import com.financing.wap.service.IDstNewrankArticleService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_newrank_article  
 * 抓取热文列表 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstNewrankArticleService")
public class DstNewrankArticleServiceImpl implements IDstNewrankArticleService{

	@Autowired
	private IDstNewrankArticleDao dstNewrankArticleDao;

	@Override
	public int insert(DstNewrankArticleDTO dstNewrankArticle) throws SQLException {
		dstNewrankArticle.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstNewrankArticleDao.insert(dstNewrankArticle);
	}

	@Override
	public void update(DstNewrankArticleDTO dstNewrankArticle) throws SQLException {
		dstNewrankArticleDao.update(dstNewrankArticle);
	}

	@Override
	public void updateForce(DstNewrankArticleDTO dstNewrankArticle) throws SQLException {
		dstNewrankArticleDao.updateForce(dstNewrankArticle);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstNewrankArticleDao.delete(id);
	}
	
	@Override
	public List<DstNewrankArticleDTO> queryList(DstNewrankArticleDTO dstNewrankArticle) throws SQLException {
		return dstNewrankArticleDao.queryList(dstNewrankArticle);
	}

	@Override
	public int queryListCount(DstNewrankArticleDTO dstNewrankArticle) throws SQLException {
		return dstNewrankArticleDao.queryListCount(dstNewrankArticle);
	}

	@Override
	public DstNewrankArticleDTO loadById(Integer id) throws SQLException {
		return dstNewrankArticleDao.loadById(id);
	}
 	@Override
	public DstNewrankArticleDTO queryListGetFirst(DstNewrankArticleDTO dstNewrankArticle)
			throws SQLException {
		 List<DstNewrankArticleDTO> queryList = queryList(dstNewrankArticle);
		 if(queryList==null||queryList.size()==0){
			 return new DstNewrankArticleDTO();
		 }
		 return queryList.get(0);
	}
}
